- current_part = Ekylibre::Navigation.part_of(controller.controller_path, action_name)

- main_tools = capture do
  - if current_user
    - count = current_user.unread_notifications.count
    %li{class: (controller_name == 'notifications' ? :active : nil)}
      = link_to(content_tag(:i), backend_notifications_path(redirect: request.fullpath), data: {toggle: 'notifications'}, title: :x_notifications.tl(count: count), class: (!count.zero? ? 'with-notifications' : nil))
    %li= link_to(content_tag(:i, nil, class: 'icon icon-help'), "https://doc.ekylibre.com/v2", title: :help.tl, target: :_blank)
%nav#top

  %ul#menu
    = main_tools
    %li= link_to(content_tag(:i), "#side", data: {toggle: "side"})

  = link_to(backend_root_path, id: "home") do
    %i
    = :home.tl

  - if current_part
    = link_to(current_part.human_name, { controller: "/backend/dashboards", action: current_part.name }, id: "part")

  .collapse

    - if true # current_part
      %ul#parts
        - Ekylibre::Navigation.parts.each do |part|
          - next unless part_authorized?(part)
          %li.separator
          :ruby
            attrs = {id: "#{part.name}-part"}
            attrs[:class] = :active if current_part == part
          %li{attrs}
            = link_to(controller: "/backend/dashboards", action: part.name) do
              %i
              = part.human_name

    %ul#user
      = main_tools
      %li.dropdown
        = link_to("#", data: { toggle: 'dropdown' }) do
          = Entity.of_company.full_name
          %i
        %ul#user-menu.dropdown-menu
          %li
            = link_to(backend_myself_path, class: :user) do
              %i
              = current_user.name
          %li
            = link_to(destroy_user_session_path, :method => :delete, class: :signout) do
              %i
              = Authentication::SessionsController.human_action_name(:destroy)
